'''
问题:编写一个程序，以2位数字，X,Y作为输入，生成一个二维数组。数组的第i行和第j列中的元素值应该是i*j。
注意:i= 0,1 . .,X - 1;    j = 0, 1,­Y-1。
例子假设程序有以下输入:3、5
则程序输出为:[[0,0,0,0,0],[0,1,2,3,4],[0,2,4,6,8]]
'''
#方法一：和第6个案列一样，在装饰器的函数中来解决数据的验证与重构
# def check(func):
#     def wapper(*args,**kwargs):
#         for i in args[0]:
#             #验证的时候没有考虑其它的输入形式，只考虑了数字字符串
#             if int(i)<0:
#                 print("行或列不能为负数!")
#                 return 0
#             for i in range(len(args[0])):
#                 args[0][i] = int(args[0][i])
#         func(*args,**kwargs)
#     return wapper
# @check
# def print_array(xy):
#      res_List = []
#      for i in range(xy[0]):
#          h = []
#          for j in range(xy[1]):
#              h.append(i*j)
#          res_List.append(h)
#      print(res_List)
#
# xy = input("请输入x行与y列的x与y:").strip().split(",")
# print_array(xy)

#方法2
print('请输入两个数字：')
input_str = input()
dimensions = [int(x) for x in input_str.split(',')]
rowNum = dimensions[0]
colNum = dimensions[1]
multilist = [[0 for col in range(colNum)] for row in range(rowNum)]

for row in range(rowNum):
    for col in range(colNum):
        multilist[row][col] = row * col

print(multilist)
